﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace Anythink.Mvc
{
    public class ActionLogFilter : IActionFilter
    {
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (!filterContext.Canceled && filterContext.Exception == null)
            {
                Record(
                    action: filterContext.ActionDescriptor.ActionName,
                    controller: filterContext.ActionDescriptor.ControllerDescriptor.ControllerName,
                    namespaceOfController: filterContext.ActionDescriptor.ControllerDescriptor.ControllerType.Namespace,
                    url: filterContext.HttpContext.Request.RawUrl
                );
            }
        }

        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            
        }

        void Record(string action, string controller, string namespaceOfController, string url)
        {

        }


    }
}
